<?php
/**
 * IMMOPHP
 * @desc Page de gestion des blocs
 * @author Drouche Romain
 * @email contact@immophp.fr
 * */
require 'kernel/common.php';
if(!$Session->check_admin()) redirect('index.php');
require_once IMMOPHP_ADMIN_ROOT_PATH.'kernel/Bloc.class.php';
require_once IMMOPHP_ADMIN_ROOT_PATH . 'kernel/BlocManager.class.php';

$Bloc = new Bloc($paramClass);
$BlocManager = new BlocManager($paramClass);

# Gestion des actions sur les blocs
if( isset($_POST['add_html']) ) 
    $BlocManager->setAddHtml();
    
if(isset($_GET['delete'])) 
    $BlocManager->setDelete();
    
if(isset($_POST['edit_bloc_html'])) 
    $BlocManager->setEditHtml();
    
if(isset($_POST['edit_bloc'])) 
    $BlocManager->setEdit();
    
if(isset($_POST['active_bloc'])) 
    $BlocManager->setActive();

$Bloc->getAll();
$Bloc->getDisponible();

$smarty->assign('token', $Session->_session['token']);
$smarty->assign('lang', $lang);
$smarty->assign('champ_contenu', get_ckeditor('contenu','') );

$smarty->display('bloc.tpl');

require_once 'footer.php';
?>